﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ComModel;

namespace ComDAL
{
    public class registerLogin_dal
    {
        public int Login(string name,string pwd)//登陆验证
        {
            StringBuilder str = new StringBuilder();
            str.Append("select count(*) from [tb_user] where [user_name]='"+name+"' and user_password='"+pwd+"'");
            return DBHelper.GetScalar(str.ToString());
        }
        public int Register(UserModel u)//注册
        {
            StringBuilder str = new StringBuilder();
            str.Append("INSERT INTO [dbo].[tb_user]([user_name] ,[user_password],[user_face],[user_sex],[user_phone],[user_email] ,[user_regTime],[User_loginTime])VALUES('"+u.user_name+"','"+u.user_password+"','"+u.user_face+"','"+u.user_sex+"','"+u.user_phone+"','"+u.user_email+"','"+u.user_regTime+"','')");
            return DBHelper.ExecuteNonQuery(str.ToString());
        }
    }
}
